package com.firebird.app.fekpsl.api

import com.firebird.app.fekpsl.bean.HttpResult
import com.firebird.app.fekpsl.bean.LoginData
import com.firebird.app.fekpsl.bean.UserInfoBody
import io.reactivex.Observable
import retrofit2.http.*

/**
 * Created by firebird on 2018/4/21.
 */
interface UserApiService {
    /**
     * 登录
     * http://www.fejpslan.com/user/login
     * @param username
     * @param password
     */
    @PUT("user/login/{username}/{password}")
    fun loginFejpslAndroid(@Path("username") username: String,
                           @Path("password") password: String): Observable<HttpResult<LoginData>>

    /**
     * 注册
     * http://www.fejpslan.com/user/register
     * @param username
     * @param password
     * @param repassword
     */
    @PUT("user/register/{username}/{password}")
    fun registerFekpslAndroid(@Path("username") username: String,
                              @Path("password") password: String): Observable<HttpResult<LoginData>>

    /**
     * 退出登录
     * http://www.fejpslan.com/user/logout/json
     */
    @GET("user/logout/json")
    fun logout(): Observable<HttpResult<Any>>

    //me
    @PUT("user/nice_name/{user_uuid}/{nice_name}")
    fun updateNiceName(@Path("user_uuid") user_uuid: String,
                       @Path("nice_name") nice_name: String): Observable<HttpResult<Any>>
    @PUT("user/real_name/{user_uuid}/{real_name}")
    fun updateRealName(@Path("user_uuid") user_uuid: String,
                       @Path("real_name") real_name: String): Observable<HttpResult<Any>>
    @PUT("user/sex/{user_uuid}/{sex}")
    fun updateSex(@Path("user_uuid") user_uuid: String,
                  @Path("sex") sex: Int): Observable<HttpResult<Any>>
    @PUT("user/is_explicit/{user_uuid}/{is_explicit}")
    fun updateIsExplicit(@Path("user_uuid") user_uuid: String,
                         @Path("is_explicit") is_explicit: Int): Observable<HttpResult<Any>>
    @PUT("user/birthday/{user_uuid}/{birthday}")
    fun updateBirthday(@Path("user_uuid") user_uuid: String,
                       @Path("birthday") birthday: String): Observable<HttpResult<Any>>
    @PUT("user/phone/{user_uuid}/{phone}")
    fun bindPhone(@Path("user_uuid") user_uuid: String,
                  @Path("phone") phone: String): Observable<HttpResult<Any>>
    @PUT("user/email/{user_uuid}/{email}")
    fun bindEmail(@Path("user_uuid") user_uuid: String,
                  @Path("email") email: String): Observable<HttpResult<Any>>
    @PUT("user/area/{user_uuid}/{area}")
    fun updateArea(@Path("user_uuid") user_uuid: String,
                   @Path("area") area: String): Observable<HttpResult<Any>>

    /**
     * 获取个人用户信息（基本信息，积分），需要登录后访问
     */
    @GET("/user_info/{userUuid}/json")
    fun getUserInfo(@Path("userUuid") userUuid: String): Observable<HttpResult<UserInfoBody>>
}